package cn.iocoder.yudao.module.scrm.dal.mysql.customer.customerrepository;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.scrm.controller.admin.customer.vo.customerrepository.CustomerRepositoryPageReqVO;
import cn.iocoder.yudao.module.scrm.dal.dataobject.customer.customerrepository.CustomerRepositoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 客户库 Mapper
 *
 * @author admin
 */
@Mapper
public interface CustomerRepositoryMapper extends BaseMapperX<CustomerRepositoryDO> {

    default PageResult<CustomerRepositoryDO> selectPage(CustomerRepositoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerRepositoryDO>()
                .eqIfPresent(CustomerRepositoryDO::getDeptIds, reqVO.getDeptIds())
                .eqIfPresent(CustomerRepositoryDO::getUserIds, reqVO.getUserIds())
                .eqIfPresent(CustomerRepositoryDO::getType, reqVO.getType())
                .likeIfPresent(CustomerRepositoryDO::getName, reqVO.getName())
                .betweenIfPresent(CustomerRepositoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerRepositoryDO::getId));
    }

}